﻿// Context.cs
// Script#/Libraries/Xrm
// Copyright (c) Shaurya Anand.
// Copyright (c) Data'Flock Consultancy Services.
// This source code is subject to terms and conditions of the Microsoft 
// Public License. A copy of the license can be found in License.txt.
//

using System;
using System.Collections;
using System.Collections.Generic;
using System.Html;
using System.Runtime.CompilerServices;

namespace Xrm.Page
{
    [Imported]
    [IgnoreNamespace]
    [ScriptName("d")]
    public class OrganizationDataServiceResult : Record
    {
        public OrganizationDataServiceResult d;
        public Dictionary<string, OrganizationDataServiceResult>[] results;
        public string[] __metadata;

        public object this[string key] { get { return null; } }
    }

    /// <summary>
    /// Provides Xrm Page functionality.
    /// </summary>
    [Imported]
    [IgnoreNamespace]
    [ScriptName("Xrm.Page.context")]
    public static class Context
    {
        /// <summary>
        /// Returns the encoded SOAP header necessary to used for Microsoft Dynamics CRM 4.0 Web service calls using JScript. 
        /// For more information about using the Microsoft Dynamics CRM 4.0 Web services see the Accessing Microsoft Dynamics CRM Web Services topic in the Microsoft Dynamics CRM 4.0 SDK.
        /// </summary>
        /// <remarks>
        /// This method is deprecated. The global getAuthenticationHeader is still available for backwards compatibility for Microsoft Dynamics CRM 4.0 scripts
        /// that are upgraded. Scripts using the SOAP endpoint for web resources or the REST endpoint for web resources do not require this function for authentication.
        /// </remarks>
        /// <returns></returns>
        public static string GetAuthenticationHeader()
        {
            return null;
        }

        /// <summary>
        /// Returns a string representing the current Microsoft Office Outlook theme chosen by the user.
        /// </summary>
        public static Theme GetCurrentTheme()
        {
            return default(Theme);
        }

        /// <summary>
        /// Returns the LCID value that represents the Microsoft Dynamics CRM Language Pack that is the base language for the organization.
        /// </summary>
        public static LCID GetOrgLcid()
        {
            return default(LCID);
        }

        /// <summary>
        /// Returns the unique text value of the organization’s name.
        /// </summary>
        public static string GetOrgUniqueName()
        {
            return null;
        }

        /// <summary>
        /// Returns a dictionary object of key value pairs representing the query string arguments that were passed to the page.
        /// </summary>
        public static string[] GetQueryStringParameters()
        {
            //TODO: Dictiomary
            return null;
        }

        /// <summary>
        /// Returns the base server URL. The format of this URL can change depending on whether the user is connected to on-premises Microsoft Dynamics CRM 2011,
        /// Microsoft Dynamics CRM Online, or working offline with Microsoft Dynamics CRM for Microsoft Office Outlook with Offline Access.
        /// </summary>
        /// <remarks>
        /// While the user is connected to the  network using on-premises Microsoft Dynamics CRM 2011, the value is: "http://[server name]/adventureworkscycle". 
        /// When the user is working offline with Microsoft Dynamics CRM for Microsoft Office Outlook with Offline Access the value is: "http://localhost:2525/adventureworkscycle""
        /// </remarks>
        public static string GetServerUrl()
        {
            return null;
        }

        /// <summary>
        /// Returns GUID value of the SystemUser.Id value for the current user.
        /// </summary>
        public static Guid GetUserId()
        {
            return null;
        }

        /// <summary>
        /// 
        /// </summary>
        public static LCID GetUserLcid()
        {
            return default(LCID);
        }

        /// <summary>
        /// Returns an array of strings representing the GUID values of each of the security roles that the user is associated with. This method does not return GUID values 
        /// representing team security roles that the user may belong to.
        /// </summary>
        public static Guid[] GetUserRoles()
        {
            return null;
        }

        /// <summary>
        /// Returns a Boolean value indicating if the user is using the Microsoft Dynamics CRM for Microsoft Office Outlook client.
        /// </summary>
        public static bool IsOutlookClient()
        {
            return default(bool);
        }

        /// <summary>
        /// Returns a Boolean value indicating whether the user is connected to the Microsoft Dynamics CRM server while using the Microsoft Dynamics CRM 
        /// for Microsoft Office Outlook with Offline Access client. When this function returns false, the user is working offline without a connection to the server. 
        /// They are interacting with an instance of Microsoft Dynamics CRM running on their local computer.
        /// </summary>
        public static bool IsOutlookOnline()
        {
            return default(bool);
        }

        /// <summary>
        /// Prepends the organization name to the specified path. <remarks>The value returned follows this pattern: "/"+ OrgName + sPath</remarks>
        /// </summary>
        public static string PrependOrgName()
        {
            return null;
        }
    }
}
